#include"myname_pipe.hpp"


int main(){
    makeseek();
    //创建通讯的管道1
    bool ret = creatfifo(PATH_NAME);
    assert(ret);
    (void)ret;

    int fp = open(PATH_NAME,O_WRONLY);
    if(fp < 0) exit(1);

    //开始写数据到管道文件
    int cnt = 0;
    char buffer[1024];//缓冲区
    while(cnt++){
        if(cnt == NUM_COMPARE)break;
        snprintf(buffer,sizeof buffer,"%d",(rand() % 3));
        write(fp,buffer,sizeof(buffer));
        sleep(1);
    }


    close(fp);

    sleep(10);
    removefifo(PATH_NAME);
    return 0;
}